home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / lfslib / lfslibInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-15  |  5.1 KB  |  168 lines

  1. /*
  2.  * lfsInt.h --
  3.  *
  4.  *    Data structures and routines internal to the Lfs library.
  5.  *
  6.  * Copyright 1990 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  * $Header: /sprite/lib/forms/RCS/proto.h,v 1.5 90/01/12 12:03:25 douglis Exp $ SPRITE (Berkeley)
  16.  */
  17.  
  18. #ifndef _LFSINT
  19. #define _LFSINT
  20.  
  21. /* constants */
  22.  
  23. /* data structures */
  24.  
  25. /* procedures */
  26.  
  27. /*
  28.  * Increase the size of the summary region to bytesNeeded bytes.
  29.  * char *
  30.  * LfsSegGrowSummary(segPtr, blocks,  bytesNeeded)
  31.  *    LfsSeg    *segPtr;     -- Segment of interest. 
  32.  *    int    blocks;        -- Insure this many data blocks remain.
  33.  *    int    bytesNeeded;    -- Number of bytes needed in the summary
  34.  *                   region.
  35.  */
  36. #define    LfsSegGrowSummary(segPtr, blocks, bytesNeeded) \
  37.     LfsSegSlowGrowSummary((segPtr), (blocks), (bytesNeeded), FALSE)
  38.  
  39. /*
  40.  * Return the value of the current pointer into the summary region.
  41.  * char *
  42.  * LfsSegGetSummaryPtr(segPtr)
  43.  *    LfsSeg    *segPtr;     -- Segment of interest. 
  44.  */
  45. #define    LfsSegGetSummaryPtr(segPtr)  ((segPtr)->curSummaryPtr)
  46.  
  47. /*
  48.  * Set the value of the current end of summary region.
  49.  * char *
  50.  * LfsSegSegSummaryPtr(segPtr, newEndPtr)
  51.  *    LfsSeg    *segPtr;     -- Segment of interest. 
  52.  *    char    *newEndPtr;    -- New value
  53.  */
  54. #define    LfsSegSetSummaryPtr(segPtr, newEndPtr)  \
  55.     ((segPtr)->curSummaryPtr = (newEndPtr))
  56.  
  57. /*
  58.  * Return the number of summary bytes left in the summary segment.
  59.  * int
  60.  * LfsSegSummaryBytesLeft(segPtr)
  61.  *    LfsSeg    *segPtr;     -- Segment of interest. 
  62.  */
  63.  
  64. #define    LfsSegSummaryBytesLeft(segPtr) \
  65.     ((segPtr)->curSummaryLimitPtr - (segPtr)->curSummaryPtr)
  66.  
  67. /*
  68.  * Return the number of file system blocks left in the segment.
  69.  * int
  70.  * LfsSegBlocksLeft(segPtr)
  71.  *    LfsSeg    *segPtr;     -- Segment of interest. 
  72.  */
  73. #define    LfsSegBlocksLeft(segPtr) ((segPtr)->curDataBlockLimit - \
  74.                   (segPtr)->curBlockOffset)
  75.  
  76. /*
  77.  * Return the disk address of an LfsSegElement
  78.  * int
  79.  * LfsSegDiskAddress(segPtr, segElementPtr)
  80.  *    LfsSeg    *segPtr;     -- Segment of interest. 
  81.  *    LfsSegElement *segElementPtr; -- Segment element of interest
  82.  */
  83.  
  84. #define    LfsSegDiskAddress(segPtr, segElementPtr) \
  85.         LfsSegSlowDiskAddress((segPtr), (segElementPtr))
  86. /*
  87.  * Add a LfsSegElement to a segment.
  88.  * LfsSegElement
  89.  * LfsSegAddDataBuffer(segPtr, blocks, bufferPtr, clientData)
  90.  *    LfsSeg    *segPtr;     -- Segment of interest. 
  91.  *    int    blocks;        -- Size of buffer to add in fsBlocks.
  92.  *    char   *bufferPtr;    -- Buffer to add.
  93.  *    ClientData clientData;    -- ClientData associated with this field.
  94.  */
  95.  
  96. #define    LfsSegAddDataBuffer(segPtr, blocks, bufferPtr, clientData) \
  97.     LfsSegSlowAddDataBuffer((segPtr), (blocks), (bufferPtr), (clientData))
  98.  
  99. #define    LfsSegGetBufferPtr(segPtr) \
  100.             ((segPtr)->segElementPtr + (segPtr)->curElement)
  101. #define    LfsSegSetBufferPtr(segPtr, bufferPtr) \
  102.         ((segPtr)->curElement = ((bufferPtr) - (segPtr)->segElementPtr))
  103.  
  104. #define    LfsSegSetCurBlockOffset(segPtr, blockOffset) \
  105.             ((segPtr)->curBlockOffset = blockOffset)
  106.  
  107. #define    LfsSegFetchBytes(segPtr, blockOffset, size) \
  108.     ((segPtr)->memPtr + LfsSegSize((segPtr)->lfsPtr) - \
  109.         LfsBlocksToBytes((segPtr)->lfsPtr, blockOffset))
  110. /* procedures */
  111. extern char *LfsSegSlowGrowSummary _ARGS_((LfsSeg *segPtr, 
  112.             int dataBlocksNeeded, int sumBytesNeeded, 
  113.             Boolean addNewBlock));
  114. extern int LfsSegSlowDiskAddress _ARGS_((LfsSeg *segPtr, 
  115.             LfsSegElement *segElementPtr));
  116. extern LfsSegElement *LfsSegSlowAddDataBuffer _ARGS_((LfsSeg *segPtr,
  117.             int blocks, char *bufferPtr, ClientData clientData));
  118.  
  119.  
  120. extern ReturnStatus LfsSegCheckPoint _ARGS_((struct Lfs *lfsPtr, 
  121.             char *checkPointPtr, 
  122.             int *checkPointSizePtr));
  123.  
  124.  
  125.  
  126. /*
  127.  * Stable memory routines.
  128.  */
  129. extern ClientData LfsLoadStableMem _ARGS_((Lfs *lfsPtr, 
  130.             LfsStableMemParams *smemParamsPtr, 
  131.             LfsStableMemCheckPoint *cpPtr));
  132.  
  133. extern Boolean LfsStableMemCheckpoint _ARGS_((struct LfsSeg *segPtr, 
  134.         char *checkPointPtr,  int *checkPointSizePtr, 
  135.         ClientData clientData));
  136. extern void LfsStableMemWriteDone _ARGS_((struct LfsSeg *segPtr, int flags, 
  137.         ClientData clientData));
  138.  
  139.  
  140. extern Boolean LfsLoadDescMap _ARGS_((Lfs *lfsPtr, int checkPointSize,
  141.             char *checkPointPtr));
  142.  
  143. extern Boolean LfsDescMapCheckpoint _ARGS_((LfsSeg *segPtr, char *checkPointPtr,
  144.             int *checkPointSizePtr));
  145.  
  146. extern void LfsDescMapWriteDone _ARGS_((LfsSeg *segPtr, int flags));
  147.  
  148. extern Boolean LfsLoadUsageArray _ARGS_((Lfs *lfsPtr, int checkPointSize, 
  149.             char *checkPointPtr));
  150.  
  151. extern Boolean LfsUsageCheckpoint _ARGS_((LfsSeg *segPtr, char *checkPointPtr,
  152.             int *checkPointSizePtr));
  153.  
  154. extern void LfsSegUsageCheckpointUpdate _ARGS_((Lfs *lfsPtr,
  155.         char *checkPointPtr, int size));
  156.  
  157. extern void LfsSegUsageWriteDone _ARGS_((LfsSeg *segPtr, int flags));
  158.  
  159.  
  160. extern Boolean LfsFileLayoutCheckpoint _ARGS_((LfsSeg *segPtr, 
  161.             char *checkPointPtr, int *checkPointSizePtr));
  162.  
  163. extern void LfsFileLayoutWriteDone _ARGS_((LfsSeg *segPtr, int flags));
  164.  
  165.  
  166. #endif /* _LFSINT */
  167.  
  168.